package org.dftproject.genesis.data.genealogy.impl.internal;

import java.util.HashSet;
import java.util.Set;

public class MergedSet<T> extends HashSet<T> {
	
	// TODO perform a lazy merge

	private static final long serialVersionUID = -4146912337005670852L;
	
	private final Set<Set<T>> sets;
	
	public MergedSet() {
		this.sets = new HashSet<Set<T>>();
	}
	
	public MergedSet(Set<Set<T>> sets) {
		this.sets = sets;
		for (Set<T> set : sets)
			this.addAll(set);
	}
	
	public void addSet(Set<T> set) {
		sets.add(set);
		this.addAll(set);
	}

}
